<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: OpenSocial::Connection</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">OpenSocial::Connection</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/lib/opensocial/connection_rb.html">
                lib/opensocial/connection.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                Object
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Describes a connection to an OpenSocial container, including the ability to
declare an authorization mechanism and appropriate credentials.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000022">new</a>&nbsp;&nbsp;
      <a href="#M000023">service_uri</a>&nbsp;&nbsp;
      <a href="#M000024">sign!</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">ORKUT</td>
          <td>=</td>
          <td class="context-item-value">{ :endpoint =&gt; 'http://sandbox.orkut.com/social',               :rest =&gt; 'rest/',               :rpc =&gt; 'rpc/',               :content_type =&gt; 'application/json',               :post_body_signing =&gt; false,               :use_request_body_hash =&gt; true }</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">IGOOGLE</td>
          <td>=</td>
          <td class="context-item-value">{ :endpoint =&gt; 'http://www-opensocial-sandbox.googleusercontent.com/api',                 :rest =&gt; '',                 :rpc =&gt; 'rpc',                 :content_type =&gt; 'application/json',                 :post_body_signing =&gt; false,                 :use_request_body_hash =&gt; true }</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">MYSPACE</td>
          <td>=</td>
          <td class="context-item-value">{ :endpoint =&gt; 'http://api.myspace.com/v2',                 :rest =&gt; '',                 :rpc =&gt; '',                 :base_uri =&gt; 'http://api.myspace.com',                 :request_token_path =&gt; '/request_token',                 :authorize_path =&gt; '/authorize',                 :access_token_path =&gt; '/access_token',                 :http_method =&gt; :get,                 :content_type =&gt; 'application/x-www-form-urlencoded',                 :post_body_signing =&gt; true,                 :use_request_body_hash =&gt; false }</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">AUTH_HMAC</td>
          <td>=</td>
          <td class="context-item-value">0</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">AUTH_ST</td>
          <td>=</td>
          <td class="context-item-value">1</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_OPTIONS</td>
          <td>=</td>
          <td class="context-item-value">{ :container =&gt; ORKUT,                         :st =&gt; '',                         :consumer_key =&gt; '',                         :consumer_secret =&gt; '',                         :consumer_token =&gt; OAuth::Token.new('', ''),                         :xoauth_requestor_id =&gt; '',                         :auth =&gt; AUTH_HMAC }</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">auth</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the authentication scheme: HMAC or security token.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">consumer_key</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the consumer key for <a href="../OAuth.html">OAuth</a>.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">consumer_secret</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the consumer secret for <a href="../OAuth.html">OAuth</a>.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">consumer_token</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the consumer token for <a href="../OAuth.html">OAuth</a>.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">container</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the container that will be used in requests.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">content_type</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the content-type when sending a request body

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">post_body_signing</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines whether or not to sign the request body (treating the body as a
large query parameter for the purposes of the signature base string)

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">st</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the security token, for when <a href="../OAuth.html">OAuth</a> is
not in use.

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">use_request_body_hash</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines whether or not to sign the body using a request body hash

</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">xoauth_requestor_id</td>
          <td class="context-item-value">&nbsp;[RW]&nbsp;</td>
          <td class="context-item-desc">
Defines the ID of the requestor (required by some implementations when
using <a href="../OAuth.html">OAuth</a>).

</td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="Connection.src/M000022.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000022.html');return false;">
          <span class="method-name">new</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Initializes the <a href="Connection.html">Connection</a> using the supplied
options hash, or the defaults. Verifies that the supplied authentication
type has proper (ie. non-blank) credentials, and that the authentication
type is known.
</p>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="Connection.src/M000023.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000023.html');return false;">
          <span class="method-name">service_uri</span><span class="method-args">(service, guid, selector, pid)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Constructs a URI to the OpenSocial endpoint given a service, guid,
selector, and pid.
</p>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="Connection.src/M000024.html" target="Code" class="method-signature"
            onclick="popupCode('Connection.src/M000024.html');return false;">
          <span class="method-name">sign!</span><span class="method-args">(http, req)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Signs a request using <a href="../OAuth.html">OAuth</a>.
</p>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>